<?php for ($i = 1; $i <= 5; $i++): ?>
    <!-- this in it's own is the beginning of a great career of the Giant -->
    <div class="<?php
    if ($i <= $doctorAverageRating)
    {
        echo "full-star";
    }
    else
    {
        echo ((($i - $doctorAverageRating) > 0 && ($i - $doctorAverageRating) < 1) && $doctorAverageRating > 0) ? "half-star" : "empty-star";
    }
    ?>" rating="<?php echo $i; ?>"></div>
<?php endfor; ?>